<template>
  <a-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">

    <table id="table_report" class="table table-striped table-bordered table-hover">

           			<tr>
           				<td style="width:90px;text-align: right;padding-top: 80px;">基本信息:</td>
           				<td>
           					<p style="float: left;">


             车场编号：<span id="parkCode" >
           {{result.parkCode }}
                    </span><br>


             停车场名称：<span id="parkName" >
           {{result.parkName }}
                    </span><br>


             车牌号：<span id="plateNo" >
           {{result.plateNo }}
                    </span><br>


             识别车牌号：<span id="identifyPlateNo" >
           {{result.identifyPlateNo }}
                    </span><br>


             车辆类型(0,无牌车，1,有牌车)：<span id="carType" >
           {{result.carType }}
                    </span><br>


             车辆性质(0:临时车,1:月租车,2储值车，3军警车）：<span id="carNature" >
           {{result.carNature }}
                    </span><br>


             识别的车牌颜色：<span id="carPalteNoColor" >
           {{result.carPalteNoColor }}
                    </span><br>


             设备序列号，设备唯一：<span id="serialNo" >
           {{result.serialNo }}
                    </span><br>


             车道名称：<span id="armName" >
           {{result.armName }}
                    </span><br>


             操作员：<span id="workStationOperator" >
           {{result.workStationOperator }}
                    </span><br>


             工作站名称：<span id="workStationName" >
           {{result.workStationName }}
                    </span><br>


             识别图片地址：<span id="identifyImgPath" >
           {{result.identifyImgPath }}
                    </span><br>


             抓拍图片地址：<span id="imgPath" >
           {{result.imgPath }}
                    </span><br>


             云图片地址：<span id="ossImgPath" >
           {{result.ossImgPath }}
                    </span><br>


             触发时间：<span id="triggerTime" >
           {{result.triggerTime }}
                    </span><br>


             1：应急开闸，2：遥控器开闸，3：无入场纪录，4：取消出场：<span id="abnormalType" >
           {{result.abnormalType }}
                    </span><br>


             备注：<span id="remark" >
           {{result.remark }}
                    </span><br>


             创建人：<span id="createBy" >
           {{result.createBy }}
                    </span><br>


             更新时间：<span id="updateTime" >
           {{result.updateTime }}
                    </span><br>


             更新操作者：<span id="updateBy" >
           {{result.updateBy }}
                    </span><br>


             逻辑删除字段0未删除，1已删除：<span id="deleted" >
           {{result.deleted }}
                    </span><br>

  创建时间：<span id="createTime" >
           {{result.createTime }}
                    </span><br>
	</p>
			</td>
                			</tr>

                				<tr>
                                    <td style="width:90px;text-align: right;padding-top: 60px;">详情:</td>
                                    <td>
                                        <p style="float: left;">


                                        </p>
                                    </td>
                            	</tr>

                			<tr>
                				<td style="text-align: center;" colspan="10">
                                 <a-button type="primary" @click="close">关闭</a-button>
                				</td>
                			</tr>
                		</table>

  </a-modal>
</template>

<script>
  import { httpAction } from '@api/manage'
  import pick from 'lodash.pick'
  import moment from "moment"

  export default {
    name: "ParkCarAbnormalRecordDetailsModal",
    data () {
      return {
        title:"操作",
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
         result: {

                },
        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules:{
        },
        url: {
          add: "/parkCarAbnormalRecord/parkCarAbnormalRecord/add",
          edit: "/parkCarAbnormalRecord/parkCarAbnormalRecord/edit",
        },
      }
    },
    created () {
    },
    methods: {
      add () {
        this.edit({});
      },
      edit (record) {
             Object.assign(this.result, record);
              this.visible = true;
            },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        const that = this;
        // 触发表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            let formData = Object.assign(this.model, values);
            //时间格式化
            formData.triggerTime = formData.triggerTime?formData.triggerTime.format('YYYY-MM-DD HH:mm:ss'):null;
            formData.updateTime = formData.updateTime?formData.updateTime.format('YYYY-MM-DD HH:mm:ss'):null;

            httpAction(httpurl,formData,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
              that.close();
            })



          }
        })
      },
      handleCancel () {
        this.close()
      },


    }
  }
</script>

<style lang="less" scoped>

</style>